package com.inexas.cu.client.pipe;

import java.io.*;
import com.google.gwt.event.shared.*;

public abstract class AbstractRequest implements Serializable {
    private static final long serialVersionUID = -2735373978352906420L;
	// todo Figure out a way of not having GwtEvents on the server side???
	private static final GwtEvent.Type<RequestHandler<?>> TYPE = new GwtEvent.Type<RequestHandler<?>>();
	private static long nextRequestId = 1;
	private long requestId;
	private String credentials;

	protected AbstractRequest() {
		// Nothing to do
	}

	public static GwtEvent.Type<RequestHandler<?>> getType() {
		return TYPE;
	}
	
	protected GwtEvent.Type<RequestHandler<?>> getAssociatedType() {
		return TYPE;
	}

	public long getRequestId() {
		return requestId;
	}

	public String getCredentials() {
    	return credentials;
    }

	public void setCredentials(String credentials) {
		// todo Make me default, not public
    	this.credentials = credentials;
    }
	
	public void setRequestId() {
		// todo Make me default, not public
		requestId = nextRequestId++;
	}

}
